﻿namespace System
{
    public static class _StringExtensions
    {
        public static string GetTextBetween(this string fullText, string start, string end)
        {
            string returnValue = string.Empty;
            if (fullText.IndexOf(start) != -1 && fullText.IndexOf(end) != -1)
            {
                returnValue = fullText.Substring(fullText.IndexOf(start) + start.Length);
                returnValue = returnValue.Substring(0, returnValue.IndexOf(end));
            }
            return returnValue;
        }

        public static string GetTextBefore(this string fullText, string end)
        {
            return fullText.IndexOf(end) != -1 ? fullText.Substring(0, fullText.IndexOf(end)) : string.Empty;
        }

        public static string GetTextAfter(this string fullText, string start)
        {
            return fullText.IndexOf(start) != -1 ? fullText.Substring(fullText.IndexOf(start) + start.Length) : string.Empty;
        }
    }
}